In general, in a magnetic disk drive, a mass of data stored in the disk, what is called a data block, is rewritten by, for example, migration. The migration of a data block is executed by the following procedure. Here, it is assumed that a data block stored in a first area of the disk is migrated to a second area of the disk. In this case, first, the data block is read from the first area of the disk. Then, the read data block is written to the second area of the disk. Alternatively, a part of the read data may be replaced with write data specified by a host, and the replaced data may then be written to the second area.
Because of the data block migration, when the data block is read from the first area, a read error may occur. Here, it is assumed that the first area comprises a plurality of sectors (data sectors) including a sector SA. It is further assumed that when data (sector data) in the sector SA is read, a read uncorrectable error occurs which cannot be corrected based on an error correction code (ECC). It is also assumed that the second area comprises a plurality of sectors including a normal sector SA′ and that the relative position of the sector SA′ in the second area coincides with that of the sector SA in the first area.
Even when an error occurs in data read from the sector SA, if the data block is written to the second area, then after the write of the data block, the content of the sector SA′ is different from that of the sector SA. Thereafter, if the data in the sector SA′ is read, for example, in accordance with a request from the host, since the sector SA′ is normal, the data read is very likely to be achieved normally. In this case, data different from that written to the sector SA, that is, incorrect (invalid) data (sector data) is returned from the magnetic disk drive to the host. However, not only the host but also the magnetic disk drive has difficulty determining that the sector data read from the sector SA′ is incorrect.
Furthermore, power to the magnetic disk drive may be shut down during the write of the data block to the second area. Thus, there has been a demand for the capability of detecting possible power shutdown during the write of the data block.